package top.itlir.edc.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import top.itlir.edc.dao.AreaRepository;
import top.itlir.edc.domain.Area;
import top.itlir.edc.domain.SubArea;
import top.itlir.edc.service.AreaService;

@Service
@Transactional
public class AreaServiceImpl implements AreaService {
	
	@Autowired
	private AreaRepository areaRepository;

	@Override
	public void batchSave(List<Area> areas) {
		for (Area area : areas) {
			areaRepository.save(area);
		}
	}

	@Override
	public Page<Area> findAll(Specification spec, Pageable pageable) {
		return areaRepository.findAll(spec, pageable);
	}

	@Override
	public List<Area> findAll() {
		return areaRepository.findAll();
	}

}

